package com.masterrabbit.mcslf.exception;

import com.masterrabbit.common.core.web.domain.AjaxResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {
//    全局异常处理接管Exception


    @ExceptionHandler(McslfException.class)
    @ResponseBody  //返回值改为JSON
    public AjaxResult error(McslfException e){
        return AjaxResult.error(e.getMessage());
    }
}